package com.ruoyi.stock.service.impl;

import com.ruoyi.stock.domain.StockUser;
import com.ruoyi.stock.mapper.StockUserMapper;
import com.ruoyi.stock.service.IStockUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 用户Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-12-30
 */
@Service
public class StockUserServiceImpl implements IStockUserService 
{
    @Autowired
    private StockUserMapper stockUserMapper;

    /**
     * 查询用户
     * 
     * @param id 用户主键
     * @return 用户
     */
    @Override
    public StockUser selectStockUserById(Long id)
    {
        return stockUserMapper.selectStockUserById(id);
    }

    /**
     * 查询用户列表
     * 
     * @param stockUser 用户
     * @return 用户
     */
    @Override
    public List<StockUser> selectStockUserList(StockUser stockUser)
    {
        return stockUserMapper.selectStockUserList(stockUser);
    }

    /**
     * 新增用户
     * 
     * @param stockUser 用户
     * @return 结果
     */
    @Override
    public int insertStockUser(StockUser stockUser)
    {
        stockUser.setCreateDate(new Date());
        return stockUserMapper.insertStockUser(stockUser);
    }

    /**
     * 修改用户
     * 
     * @param stockUser 用户
     * @return 结果
     */
    @Override
    public int updateStockUser(StockUser stockUser)
    {
        return stockUserMapper.updateStockUser(stockUser);
    }

    @Override
    public int updateStockUserBySysUserId(StockUser stockUser) {
        return stockUserMapper.updateStockUserBySysUserId(stockUser);
    }

    /**
     * 批量删除用户
     * 
     * @param ids 需要删除的用户主键
     * @return 结果
     */
    @Override
    public int deleteStockUserByIds(Long[] ids)
    {
        return stockUserMapper.deleteStockUserByIds(ids);
    }

    /**
     * 删除用户信息
     * 
     * @param id 用户主键
     * @return 结果
     */
    @Override
    public int deleteStockUserById(Long id)
    {
        return stockUserMapper.deleteStockUserById(id);
    }

    @Override
    public List<Map<String, Object>> selectMemberOrderByDay() {
        return stockUserMapper.selectMemberOrderByDay();
    }

    @Override
    public Map<String, String> selectMemberOrderCount() {
        return stockUserMapper.selectMemberOrderCount();
    }

    @Override
    public int updateUserMemberStateByMemberMaturityTime(StockUser stockUser) {
        return stockUserMapper.updateUserMemberStateByMemberMaturityTime(stockUser);
    }

    @Override
    public int updateUserMemberDays(StockUser stockUser) {
        return stockUserMapper.updateUserMemberDays(stockUser);
    }
}
